package init

import (
	"fmt"
	"github.com/go-redis/redis/v8"
	"video_rpc/basic/config"
)

func RedisInit() {

	redisINiS := config.AppConfig.Redis
	Addr := fmt.Sprintf("%s:%d", redisINiS.Host, redisINiS.Port)
	config.Rdb = redis.NewClient(&redis.Options{
		Addr:     Addr,
		Password: redisINiS.Password, // no password set
		DB:       redisINiS.Database, // use default DB
	})
	config.Rdb.Set(config.Ctx, "key", "value", 0)
	fmt.Println("redis连接成功")
}
